package com.xrh.core.generater.utils;

import java.io.File;
import java.io.IOException;

import com.xrh.core.generater.interfaces.GeneraterInterface;
import com.xrh.core.generater.interfaces.TemplateRootPath;

//模板读取器
public class TemplateReader {

	/**
	 * 读取文本模板
	 * @throws IOException 
	 */
	public static String readTextTemplate(GeneraterInterface generater , String fileName) throws IOException{
		String packagePath = generater.getTemplateRootDirPath() + File.separator + fileName;
		return FileUtils.readFileToStringByRelativePath(packagePath , "utf-8");
	}
	
	/**
	 * 读取文本模板
	 * @throws IOException 
	 */
	public static String readTextTemplate(TemplateRootPath generater , String fileName) throws IOException{
		String packagePath = generater.getTemplateRootDirPath() + File.separator + fileName;
		return FileUtils.readFileToStringByRelativePath(packagePath , "utf-8");
	}
	
}
